﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTK.Graphics.OpenGL;
using MazeRunner.Graphics;

namespace MazeRunner.GameState
{
	public enum MazeItem
	{
		Wall,
		Empty,
		LocalMaxima,
		Null,
	}
	public class Point
	{
		public int X { get; set; }
		public int Y { get; set; }

		public Point (int x, int y)
		{
			X = x;
			Y = y;
		}
	}
	public class Maze
	{
		private MazeItem[,] mazeItems;
		public int Width { get; private set; }
		public int Height { get; private set; }
		public int PointCount { get; private set; }

		public MazeItem[,] MazeItems
		{
			get { return mazeItems; } 
			set { mazeItems = value; }
		}

		public Maze(int width, int height, int pointCount)
		{
			Width = width;
			Height = height;
			PointCount = pointCount;
			mazeItems = new MazeItem[width,height];
		}

		public void DrawMaze()
		{
			for (int i = 0; i < Width; i++)
			{
				for (int j = 0; j < Height; j++)
				{
					switch (mazeItems[i,j])
					{
						case MazeItem.Wall:
							GL.Color3(0.0, 0.5, 1.0);
							Wall.Draw(i, j);
							break;
						case MazeItem.Empty:
							GL.Color3(0.5, 0.5, 0.0);
							Open.Draw(i, j);
							break;
						case MazeItem.LocalMaxima:
							GL.Color3(0.0, 1.0, 0.0);
							Open.Draw(i, j);
							break;
					}
				}
			}
		}
	}
}
